package user;

import book.BookList;
import operation.IOPeration;

/**
 * Created by cc
 * Description:
 * User: CZH
 * Date: 2022-09-23
 * Time: 21:27
 */
//User 抽象类
public abstract class User {
    //开放给子类的成员变量
    protected String name;

    //使用操作类的接口
    //用来作为存储用户选择的类型，方便之后去进行功能操作
    protected IOPeration[] ioPerations;

    public User(String name) {
        this.name = name;
    }

    //用户菜单抽象类
    public abstract int menu();

    //根据用户选择choice，到顺序表bookList中操作功能work方法
    public void doOperation(int choice, BookList bookList){
        this.ioPerations[choice].work(bookList);
    }
}
